package com.zzx.threekingdom.view;

import android.view.View.MeasureSpec;

public class MyViewGroupMeasure
{
    public static int getMeasure(int measureSpec, int myDesire)
    {
        int mode = MeasureSpec.getMode(measureSpec);
        int size = MeasureSpec.getSize(measureSpec);
        if(mode==MeasureSpec.UNSPECIFIED)
        {
            return Math.max(myDesire, size);
        }
        else if(mode==MeasureSpec.AT_MOST)
        {
            return myDesire<=size?myDesire:size;
        }
        else if(mode==MeasureSpec.EXACTLY)
        {
            return size;
        }
        return 0;

    }

}
